import { MutableRefObject } from 'react';
import { extendApi } from '@inbiz/utils';
import type { IProps } from './index';
import moment from 'moment';

export default extendApi((_events: MutableRefObject<IProps['callBackEvents']>, props: IProps) => {
  return {
    formateDate: () => {
      return props?.value&&props?.value!==''?[
        props?.value?.[0] ? moment(props?.value?.[0])?.format(props?.format) : '',
        props?.value?.[1] ? moment(props?.value?.[1])?.format(props?.format) : '',
      ]:null;
    },
  };
});
